<template>
  <div>
    <el-card shadow="always">
      <el-row type="flex" :gutter="20" align="middle">
        <el-col :span="4">
          <el-cascader
            :options="optionsArea"
            :props="{
              value: 'areaCode',
              label: 'areaName',
              children: 'children',
              checkStrictly: true,
            }"
            ref="cascader"
            @change="CascaderArea"
            :show-all-levels="false"
            v-model="query.areaCode"
          ></el-cascader>
        </el-col>
        <el-col :span="5">
          <el-cascader
            clearable
            placeholder="请选择单位业态"
            v-model="bodyindustryStr"
            :options="bodyindustryList"
            @change="onCascaderChange"
            :collapse-tags="true"
            :props="{
              checkStrictly: true,
              multiple: true,
            }"
          ></el-cascader>
        </el-col>
        <el-col :span="6">
          <el-select
            v-model="query.chiefInspector"
            clearable
            collapse-tags
            multiple
            placeholder="请选择单位类型"
          >
            <el-option
              :label="item.label"
              :value="item.value"
              v-for="item in [
                {
                  label: '未设置',
                  value: '未设置',
                },

                {
                  label: '大型餐饮服务企业',
                  value: '大型餐饮服务企业',
                },
                {
                  label: '中型餐饮服务企业',
                  value: '中型餐饮服务企业',
                },
                {
                  label: '大型食品销售企业',
                  value: '大型食品销售企业',
                },
                {
                  label: '中型食品销售企业',
                  value: '中型食品销售企业',
                },
                {
                  label: '托幼机构食堂(用餐人数300以上)',
                  value: '托幼机构食堂(用餐人数300以上)',
                },
                {
                  label: '学校食堂(用餐人数500以上)',
                  value: '学校食堂(用餐人数500以上)',
                },

                {
                  label: '其他学校食堂（含托幼机构，需总监）',
                  value: '其他学校食堂（含托幼机构，需总监）',
                },
                {
                  label: '用餐（供餐）1000人以上的单位',
                  value: '用餐（供餐）1000人以上的单位',
                },
                {
                  label: '食用农产品批发市场',
                  value: '食用农产品批发市场',
                },
                {
                  label: '网络平台（需设置总监）',
                  value: '网络平台（需设置总监）',
                },

                {
                  label: '其他企业(无需设置总监)',
                  value: '其他企业(无需设置总监)',
                },
                {
                  label: '其他企业(无需设置总监)(仅限市平台单位)',
                  value: '其他企业(无需设置总监)(仅限市平台单位)',
                },
              ]"
              :key="item.value"
            ></el-option>
          </el-select>
        </el-col>

        <el-col :span="6">
          <el-select
            v-model="query.keyUnit"
            clearable
            multiple
            collapse-tags
            placeholder="请选择重点单位类型"
          >
            <el-option
              :label="item.label"
              :value="item.value"
              v-for="item in [
                {
                  label: '未设置',
                  value: '未设置',
                },

                {
                  label: '特大型餐饮单位',
                  value: '特大型餐饮单位',
                },
                {
                  label: '中央厨房',
                  value: '中央厨房',
                },
                {
                  label: '养老机构食堂',
                  value: '养老机构食堂',
                },
                {
                  label: '集体用餐配送单位',
                  value: '集体用餐配送单位',
                },
                {
                  label: '学校食堂',
                  value: '学校食堂',
                },
                {
                  label: '特殊学校食堂',
                  value: '特殊学校食堂',
                },
                  {
                      label: '食品安全工作站',
                      value: '食品安全工作站',
                    },
                       {
                      label: '连锁企业门店',
                      value: '连锁企业门店',
                    },
              ]"
              :key="item.value"
            ></el-option>
          </el-select>
        </el-col>

        <el-col :span="4">
          <el-select
            v-model="query.indexScore"
            clearable
            placeholder="精准画像"
            @change="changeScore"
          >
            <el-option label="精准画像" value="0-1000"></el-option>
            <el-option label="80-100" value="80-100"></el-option>
            <el-option label="60-79" value="60-79"></el-option>
            <el-option label="0-59" value="0-59"></el-option>

            <!-- 绿码(分值范围)：80分以上；黄码(分值范围)：60分—79分；红码(分值范围)：60分以下； -->
          </el-select>
        </el-col>
        <!-- <el-col :span="4">
          <el-select
            v-model="query.licensestatus"
            clearable
            placeholder="许可证状态"
          >
            <el-option label="有效" value="1"></el-option>
            <el-option label="待注销" value="2"></el-option>
            <el-option label="已注销" value="3"></el-option>
            <el-option label="已到期" value="4"></el-option>
          </el-select>
        </el-col> -->

        <el-col :span="7">
          <el-date-picker
            :picker-options="pickerOptions"
            v-model="time"
            type="daterange"
            range-separator="至"
            start-placeholder="注册开始日期"
            end-placeholder="注册结束日期"
            @change="registrationTime"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>
        </el-col>
      </el-row>

      <rz-height></rz-height>
      <el-row type="flex" :gutter="20" align="middle">
        <el-col :span="7">
          <el-date-picker
            :picker-options="pickerOptions"
            v-model="time1"
            type="daterange"
            range-separator="至"
            :clearable="false"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            value-format="yyyy-MM-dd"
            @change="CompletionTime"
          >
          </el-date-picker>
        </el-col>
        <el-col :span="4">
          <el-input
            clearable
            maxlength="50"
            v-model="query.identify"
            placeholder="请输入统一社会信用代码"
          ></el-input>
        </el-col>
        <el-col :span="4">
          <el-input
            maxlength="50"
            clearable
            v-model="query.newlicenseno"
            placeholder="请输入许可证编号"
          ></el-input>
        </el-col>
        <el-col :span="6">
          <el-input
            clearable
            maxlength="50"
            v-model="query.unitname"
            placeholder="请输入单位名称"
          ></el-input>
        </el-col>
      </el-row>
      <rz-height></rz-height>
      <el-checkbox v-model="query.isspecialfood" true-label="1" false-label="0"
        >特殊食品</el-checkbox
      >
      <!-- <el-checkbox
        v-model="query.isinternetsales"
        true-label="1"
        false-label="0"
        >网络经营</el-checkbox
      > -->
      <el-checkbox v-model="query.islargerkitchen" true-label="1" false-label="0"
        >中央厨房</el-checkbox
      >
      <!-- <el-checkbox
        v-model="query.isspecialmedicine"
        true-label="1"
        false-label="0"
        >特殊医学用途配方食品</el-checkbox
      > -->
      <el-checkbox v-model="query.iscollectivedistribution" true-label="1" false-label="0"
        >集体用餐配送</el-checkbox
      >
      <!-- <el-checkbox v-model="query.admin" :true-label="1" :false-label="0"
        >食品安全员已注册</el-checkbox
      > -->

      <el-select
        style="margin-left: 10px; width: 150px"
        v-model="query.isPeople"
        placeholder="请选择单位状态"
      >
        <el-option
          :label="item.label"
          :value="item.value"
          v-for="item in [
            {
              label: '单位是否注册',
              value: '',
            },
            {
              label: '已注册',
              value: '1',
            },
            {
              label: '未注册',
              value: '2',
            },
          ]"
          :key="item.value"
        >
        </el-option>
      </el-select>

      <el-select
        style="margin-left: 10px; width: 150px"
        v-model="query.brisk"
        placeholder="请选择单位状态"
      >
        <el-option
          :label="item.label"
          :value="item.value"
          v-for="item in [
            {
              label: '全部',
              value: '',
            },
            {
              label: '活跃单位',
              value: '1',
            },
            {
              label: '不活跃单位',
              value: '2',
            },
          ]"
          :key="item.value"
        >
        </el-option>
      </el-select>

      <el-select
        style="margin-left: 10px; width: 150px"
        v-model="query.unitstatusStr"
        placeholder="请选择单位状态"
      >
        <el-option
          :label="item.label"
          :value="item.value"
          v-for="item in [
            {
              label: '单位状态',
              value: '',
            },
            {
              label: '在业',
              value: '01',
            },
            {
              label: '企业直接申请注销',
              value: '02',
            },

            {
              label: '在业(停业)',
              value: '05',
            },
          ]"
          :key="item.value"
        ></el-option>
      </el-select>
      <!-- <el-checkbox v-model="query.isbbf" true-label="1" false-label="0"
        >婴幼儿配方食品</el-checkbox
      > -->
      <!--
      <el-checkbox v-model="query.ishealthfood" true-label="1" false-label="0"
        >保健食品</el-checkbox> -->
      <!-- <el-checkbox v-model="query.pilotUnit" true-label="1" false-label="0"
        >重点单位</el-checkbox
      > -->

      <!-- <el-checkbox v-model="query.label" true-label="1" false-label="0"
        >总监单位</el-checkbox
      > -->
<el-select  style="margin-left: 10px; width: 150px"
            v-model="query.legalUnitStatus"
  
            placeholder="请选择执照状态"
          >
            <el-option
              :label="item.label"
              :value="item.value"
              v-for="item in [
                  {
                  value: '',
                  label: '执照状态',
                },
                {
                  value: '01',
                  label: '在业',
                },

                {
                  value: '02',
                  label: '企业直接申请注销',
                },
                {
                  value: '03',
                  label: '吊销后未注销',
                },
                {
                  value: '04',
                  label: '迁出',
                },
                {
                  value: '05',
                  label: '在业(停业)',
                },
                {
                  value: '06',
                  label: '吊销(小于2004年7月1日)',
                },
                {
                  value: '12',
                  label: '吊销后注销',
                }, {
                  value: '13',
                  label: '个体户撤销',
                },
              ]"
              :key="item.value"
            ></el-option>
          </el-select>
      <el-button type="primary" @click="getweiOrder(1)" icon="el-icon-search"
        >查询</el-button
      >
      <el-button type="default" @click="getExport">导出</el-button>
      <el-button type="default" @click="getPilotExport">通报导出</el-button>
      <rz-height></rz-height>
      <div class="right">
        <el-dropdown :hide-on-click="false">
          <el-button type="primary">
            <i class="el-icon-s-grid"></i>
          </el-button>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item v-for="(item, index) in isList" :key="index">
              <el-checkbox v-model="isList[index].key">{{ item.value }}</el-checkbox>
            </el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
      <rz-height></rz-height>

      <el-row>
        <el-col :span="24">
          <el-table
            border
            :data="tableData"
            style="width: 100%"
            stripe
            @sort-change="sortChange"
          >    <el-table-column label="执照状态" prop="districtName" width="120">
              <template slot-scope="scope">
                 <div v-if="scope.row.legalUnitStatusStr">
                   <el-tag type="success" v-if="scope.row.legalUnitStatusStr=='在业'">{{ scope.row.legalUnitStatusStr }}</el-tag>
                   <el-tag type="danger" v-else>{{ scope.row.legalUnitStatusStr }}</el-tag>
                 </div>
                 <el-tag type="success" v-else>在业</el-tag>


                  
              </template>
            </el-table-column>
            <el-table-column label="区域街道" prop="districtName" width="180">
              <template slot-scope="scope">
                <div>{{ scope.row.districtName }}--{{ scope.row.streetName }}</div>
              </template>
            </el-table-column>

            <el-table-column
              label="营业执照名称"
              prop="unitname"
              width="250"
            ></el-table-column>
            <el-table-column
              v-if="isList[3].key"
              label="经营者名称"
              width="250"
              prop="operatorname"
            ></el-table-column>
            <el-table-column
              label="精准画像"
              sortable="custom"
              prop="indexScore"
              width="110"
            >
              <template slot-scope="scope">
                <div v-if="scope.row.indexScore >= 80" class="green">
                  {{ scope.row.indexScore }}
                </div>
                <div v-else-if="scope.row.indexScore > 60" class="yellow">
                  {{ scope.row.indexScore }}
                </div>
                <div v-else class="red">{{ scope.row.indexScore }}</div>
              </template>
            </el-table-column>
            <el-table-column label="单位业态" width="200" prop="bodyindustry">
              <template slot-scope="scope">
                <div>
                  {{ scope.row.bodyindustry
                  }}{{
                    scope.row.bodyindustryremarks
                      ? "--" + scope.row.bodyindustryremarks
                      : ""
                  }}
                </div>
              </template>
            </el-table-column>

            <!-- <el-table-column
              label="单位业态备注"
              width="140"
              prop="bodyindustryremarks"
            >
                 <template slot-scope="scope">
                <div >{{ scope.row.bodyindustryremarks||'--' }}</div>
              </template>


            </el-table-column> -->

            <el-table-column
              width="180"
              label="统一社会信用代码"
              prop="identify"
            ></el-table-column>
            <!-- <el-table-column
              v-if="isList[0].key"
              label="单位业态备注"
              prop="bodyindustryremarks"
            ></el-table-column> -->
            <el-table-column
              label="单位类型"
              prop="corptype"
              v-if="isList[0].key"
            ></el-table-column>

            <el-table-column label="许可证编号" width="150" prop="newlicenseno">
              <template slot-scope="scope">
                <div>{{ scope.row.newlicenseno || "--" }}</div></template
              ></el-table-column
            >
            <el-table-column
              v-if="isList[1].key"
              label="地址"
              width="180"
              prop="productionaddress"
            ></el-table-column>
            <el-table-column v-if="isList[2].key" label="注册日期" prop="createdatetime">
              <template slot-scope="scope">
                <div v-if="scope.row.createdatetime == '1970-02-01'">--</div>
                <div v-else>{{ scope.row.createdatetime }}</div>
              </template>
            </el-table-column>

            <el-table-column
              v-if="isList[4].key"
              label="许可发证日期"
              prop="certificationcreatedate"
            >
              <template slot-scope="scope">
                <div v-if="scope.row.certificationcreatedate == '1970-02-01'">--</div>
                <div v-else>{{ scope.row.certificationcreatedate }}</div>
              </template>
            </el-table-column>
            <el-table-column
              v-if="isList[5].key"
              label="许可有效期至"
              prop="validitydate"
            >
              <template slot-scope="scope">
                <div v-if="scope.row.validitydate == '1970-02-01'">--</div>
                <div v-else-if="scope.row.validitydate == '1970-01-01'">--</div>
                <div v-else>{{ scope.row.validitydate }}</div>
              </template>
            </el-table-column>
            <el-table-column label="许可状态" prop="licensestatus" v-if="isList[6].key">
            </el-table-column>
            <el-table-column label="执照核准日期" prop="issuedate" v-if="isList[7].key">
              <template slot-scope="scope">
                <div v-if="scope.row.issuedate == '1970-01-01'">--</div>
                <div v-else>{{ scope.row.issuedate }}</div>
              </template>
            </el-table-column>
            <el-table-column label="特殊食品" prop="isspecialfood" v-if="isList[8].key">
            </el-table-column>
            <el-table-column label="网络经营" prop="isnetbusiness" v-if="isList[9].key">
            </el-table-column>
            <el-table-column
              label="中央厨房"
              prop="islargerkitchen"
              v-if="isList[10].key"
            >
            </el-table-column>

            <el-table-column
              label="集体用餐配送"
              prop="iscollectivedistribution"
              v-if="isList[11].key"
            >
            </el-table-column>
            <el-table-column label="保健食品" prop="ishealthfood" v-if="isList[12].key">
            </el-table-column>

            <el-table-column label="婴幼儿配方食品" prop="isbbf" v-if="isList[13].key">
            </el-table-column>
            <el-table-column
              v-if="isList[14].key"
              label="特殊医学用途配方食品"
              prop="isspecialmedicine"
            >
            </el-table-column>

            <el-table-column
              v-if="isList[15].key"
              label="从业人员数"
              prop="congyeNum"
            ></el-table-column>

            <el-table-column
              v-if="isList[16].key"
              label="食品安全管理员数"
              prop="safeAdminNum"
            ></el-table-column>
            <el-table-column
              v-if="isList[17].key"
              label="红码"
              prop="codeRed"
            ></el-table-column>
            <el-table-column
              v-if="isList[18].key"
              label="黄码"
              prop="codeYellow"
            ></el-table-column>
            <el-table-column
              v-if="isList[19].key"
              label="绿码"
              prop="codeGreen"
            ></el-table-column>
            <el-table-column
              v-if="isList[20].key"
              label="未完善"
              prop="codeEmpty"
            ></el-table-column>

            <el-table-column
              v-if="isList[21].key"
              label="培训登记"
              prop="recordCompleteCount"
            ></el-table-column>
            <!-- <el-table-column
              v-if="isList[22].key"
              label="食安承诺书"
              prop="commitmentSign"
              width="120"
            >
              <template slot-scope="scope">
                <div v-if="scope.row.commitmentSign == 1">已签署</div>
                <div v-else>未签署</div>
              </template>
            </el-table-column> -->
            <el-table-column v-if="isList[22].key" label="食安制度" prop="systemSign">
              <template slot-scope="scope">
                <div v-if="scope.row.systemSign == 1">已上传</div>
                <div v-else>未上传</div>
              </template>
            </el-table-column>
            <!-- <el-table-column
                v-if="isList[25].key"
              label="进货查验"
              prop="incomingInspectionSign"
            >
             <template slot-scope="scope">
                <div v-if="scope.row.incomingInspectionSign==1">
                    已上传
                </div>
                <div v-else>
                  未上传
                </div>
              </template>
            </el-table-column>
            <el-table-column
                v-if="isList[26].key"
              label="人员任命"
              prop="personnelAppointmentSign"
            >
             <template slot-scope="scope">
                <div v-if="scope.row.personnelAppointmentSign==1">
                 已上传
                </div>
                <div v-else>
                未上传
                </div>
              </template>
            </el-table-column> -->
            <el-table-column label="索证索票" v-if="isList[23].key" align="center">
              <el-table-column
                label="批次数"
                width="80"
                prop="purchaseBillTotal"
              ></el-table-column>
            </el-table-column>
            <!-- <el-table-column label="常规性自查" v-if="isList[25].key" align="center">
              <el-table-column
                label="任务数"
                width="70"
                prop="routineSelfInspection"
              ></el-table-column>
              <el-table-column
                label="完成数"
                width="70"
                prop="routineSelfInspectionSign"
              ></el-table-column>
            </el-table-column> -->

            <el-table-column label="全项目自查" v-if="isList[24].key" align="center">
              <el-table-column
                label="任务数"
                width="70"
                prop="wholeProject"
              ></el-table-column>
              <el-table-column
                label="完成数"
                width="70"
                prop="wholeProjectSign"
              ></el-table-column>
            </el-table-column>

            <!-- <el-table-column label="自查报告" v-if="isList[29].key" align="center">
         <el-table-column
              label="任务数"
                 width="70"
              prop="inspectionReport"
            ></el-table-column>
            <el-table-column
              label="完成数"
                 width="70"
              prop="inspectionReportSign"
            ></el-table-column>
    </el-table-column> -->
            <el-table-column
              v-if="isList[25].key"
              label="自查报告"
              prop="inspectionReportSign"
            ></el-table-column>
            <!-- <el-table-column label="索证索票" v-if="isList[30].key" align="center">
            <el-table-column
              label="任务数"
                 width="70"
              prop="certificateAndTicket"
            ></el-table-column>
            <el-table-column
              label="完成数"
                 width="70"
              prop="certificateAndTicketSign"
            ></el-table-column>
    </el-table-column> -->

            <!-- <el-table-column label="快检管理" v-if="isList[31].key" align="center">
             <el-table-column
              label="任务数"
                 width="70"
              prop="fastDetection"
            ></el-table-column>
            <el-table-column
              label="完成数"
                 width="70"
              prop="fastDetectionSign"
            ></el-table-column>
    </el-table-column> -->

            <el-table-column label="留样管理" v-if="isList[26].key" align="center">
              <el-table-column
                label="任务数"
                width="70"
                prop="retentionManagement"
              ></el-table-column>
              <el-table-column
                label="完成数"
                width="70"
                prop="retentionManagementSign"
              ></el-table-column>
            </el-table-column>

            <el-table-column label="废弃物处理" v-if="isList[27].key" align="center">
              <el-table-column
                label="任务数"
                width="70"
                prop="wasteDisposal"
              ></el-table-column>
              <el-table-column
                label="完成数"
                width="70"
                prop="wasteDisposalSign"
              ></el-table-column>
            </el-table-column>

            <el-table-column label="餐具消毒" v-if="isList[28].key" align="center">
              <el-table-column
                label="任务数"
                width="70"
                prop="tablewareDisinfection"
              ></el-table-column>
              <el-table-column
                label="完成数"
                width="70"
                prop="tablewareDisinfectionSign"
              ></el-table-column>
            </el-table-column>

            <el-table-column label="岗前检查" v-if="isList[29].key" align="center">
              <el-table-column
                label="任务数"
                width="70"
                prop="preJobInspection"
              ></el-table-column>
              <el-table-column
                label="完成数"
                width="70"
                prop="preJobInspectionSign"
              ></el-table-column>
            </el-table-column>

            <!-- <el-table-column label="菜谱管理" v-if="isList[36].key" align="center">
         <el-table-column
              label="任务数"
                 width="70"
              prop="menuManagement"
            ></el-table-column>
            <el-table-column
              label="完成数"
                 width="70"
              prop="menuManagementSign"
            ></el-table-column>
    </el-table-column> -->

            <el-table-column
              v-if="isList[30].key"
              label="菜谱管理"
              prop="menuManagementSign"
            ></el-table-column>

            <!-- <el-table-column label="食谱管理" v-if="isList[37].key" align="center">
         <el-table-column
              label="任务数"
                 width="70"
              prop="recipeManagement"
            ></el-table-column>
            <el-table-column
              label="完成数"
                 width="70"
              prop="recipeManagementSign"
            ></el-table-column>
    </el-table-column> -->
            <el-table-column
              v-if="isList[31].key"
              label="食谱管理"
              prop="recipeManagementSign"
            ></el-table-column>

            <el-table-column label="陪餐管理" v-if="isList[32].key" align="center">
              <el-table-column
                label="任务数"
                width="70"
                prop="mealManagement"
              ></el-table-column>
              <el-table-column
                label="完成数"
                width="70"
                prop="mealManagementSign"
              ></el-table-column>
            </el-table-column>

            <!-- <el-table-column label="检验管理" v-if="isList[39].key" align="center">
            <el-table-column
              label="任务数"
              prop="inspectionManagement"
              width="70"
            ></el-table-column>
            <el-table-column
              label="完成数"
               width="70"
              prop="inspectionManagementSign"
            ></el-table-column>
    </el-table-column> -->

            <el-table-column label="操作" prop="indexScore" width="220" fixed="right">
              <template slot-scope="scope">
                <el-button type="success" size="mini" @click="edit(scope.row)"
                  >编辑</el-button
                >
                <el-button type="primary" size="mini" @click="score(scope.row)"
                  >企业状况图</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <pagination
            :total="total"
            :page.sync="query.pageIndex"
            @pagination="findFoodSafetyClassList"
            v-show="total"
          />
        </el-col>
      </el-row>
    </el-card>

    <rz-dialog
      :dialogVisible.sync="dialogVisible"
      title="编辑单位标签"
      width="80%"
      @onconfirm="onconfirm"
    >
      <el-form ref="form" :model="form" label-width="160px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="营业执照名称">
              {{ viewData.unitname }}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="统一社会信用代码">
              {{ viewData.identify }}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="经营者名称">
              {{ viewData.operatorname || "--" }}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="许可证编号">
              {{ viewData.newlicenseno || "--" }}
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <!-- <el-col :span="14">
            <el-form-item label="区域街道">
              {{ viewData.districtName }}--{{ viewData.streetName }}
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="单位业态">
              {{ viewData.bodyindustry
              }}{{
                viewData.bodyindustryremarks
                  ? "--" + viewData.bodyindustryremarks
                  : ""
              }}
            </el-form-item>
          </el-col> -->

          <el-col :span="12">
            <el-form-item label="区域街道">
              <el-cascader
                :options="optionsAreas"
                :props="{
                  value: 'areaCode',
                  label: 'areaName',
                  children: 'children',
                }"
                ref="cascader"
                @change="
                  (e) => {
                    sendData.streetCode = e[e.length - 1];
                    sendData.districtCode = e[e.length - 2];
                  }
                "
                v-model="sendData.streetCode"
              ></el-cascader>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="单位状态">
              <el-select v-model="sendData.unitstatusStr" placeholder="请选择单位类型">
                <el-option
                  :label="item.label"
                  :value="item.value"
                  v-for="item in [
                    {
                      label: '在业',
                      value: '01',
                    },
                    {
                      label: '企业直接申请注销',
                      value: '02',
                    },

                    {
                      label: '在业(停业)',
                      value: '05',
                    },
                  ]"
                  :key="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <!-- <el-row>
          <el-col :span="24">
            <el-form-item label="单位标签">
              <el-row>
                <el-col :span="8">
                  <el-checkbox-group v-model="sendData.labelName">
                    <el-checkbox
                      :label="item"
                      v-for="(item, index) in sendData.newLicenseNo?labelData:['总监企业']"
                      :key="index"
                    ></el-checkbox>
                  </el-checkbox-group>
                </el-col>
                <el-col :span="12">
                  <el-select
                    v-if="sendData.labelName.includes('重点单位')"
                    v-model="sendData.typeAStr"
                    clearable
                    placeholder="请选择单位业态"
                  >
                    <el-option
                      :label="item.label"
                      :value="item.value"
                      v-for="item in [
                        {
                          label: '特大型餐饮单位',
                          value: 1,
                        },
                        {
                          label: '中央厨房',
                          value: 2,
                        },
                        {
                          label: '养老机构食堂',
                          value: 3,
                        },
                        {
                          label: '集体用餐配送单位',
                          value: 4,
                        },
                        {
                          label: '学校食堂',
                          value: 5,
                        },
                        {
                          label: '特殊学校食堂',
                          value: 6,
                        },
                        {
                          label: '食品安全工作站',
                          value: 7,
                        },
                      ]"
                      :key="item.value"
                    ></el-option>
                  </el-select>
                </el-col>
              </el-row>
            </el-form-item>
          </el-col>
        </el-row> -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="单位类型">
              <el-select v-model="sendData.remark" clearable placeholder="请选择单位类型">
                <el-option
                  :label="item.label"
                  :value="item.value"
                  v-for="item in [
                    {
                      label: '无需主体责任',
                      value: '无需主体责任',
                    },
      {
                      label: '其他企业(无需设置总监)',
                      value: '其他企业(无需设置总监)',
                    },
                    {
                      label: '大型餐饮服务企业',
                      value: '大型餐饮服务企业',
                    },
                    {
                      label: '中型餐饮服务企业',
                      value: '中型餐饮服务企业',
                    },
                    {
                      label: '大型食品销售企业',
                      value: '大型食品销售企业',
                    },
                    {
                      label: '中型食品销售企业',
                      value: '中型食品销售企业',
                    },
                    {
                      label: '托幼机构食堂(用餐人数300以上)',
                      value: '托幼机构食堂(用餐人数300以上)',
                    },
                    {
                      label: '学校食堂(用餐人数500以上)',
                      value: '学校食堂(用餐人数500以上)',
                    },

                    {
                      label: '其他学校食堂（含托幼机构，需总监）',
                      value: '其他学校食堂（含托幼机构，需总监）',
                    },

                    {
                      label: '用餐（供餐）1000人以上的单位',
                      value: '用餐（供餐）1000人以上的单位',
                    },
                    {
                      label: '食用农产品批发市场',
                      value: '食用农产品批发市场',
                    },
                    {
                      label: '网络平台（需设置总监）',
                      value: '网络平台（需设置总监）',
                    },

              
                    {
                      label: '其他企业(无需设置总监)(仅限市平台单位)',
                      value: '其他企业(无需设置总监)(仅限市平台单位)',
                    },
                  ]"
                  :key="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="重点单位" v-if="sendData.newLicenseNo">
           
              <el-select
                v-model="sendData.typeAStr"
                clearable
                placeholder="请选择重点单位业态"
              >
                <el-option
                  :label="item.label"
                  :value="item.value"
                  v-for="item in [
                    {
                      label: '请选择重点单位业态',
                      value: '',
                    },
                    {
                      label: '特大型餐饮单位',
                      value: 1,
                    },
                    {
                      label: '中央厨房',
                      value: 2,
                    },
                    {
                      label: '养老机构食堂',
                      value: 3,
                    },
                    {
                      label: '集体用餐配送单位',
                      value: 4,
                    },
                    {
                      label: '学校食堂',
                      value: 5,
                    },
                    {
                      label: '特殊学校食堂',
                      value: 6,
                    },
                    {
                      label: '食品安全工作站',
                      value: 7,
                    },
                       {
                      label: '连锁企业门店',
                      value: 8,
                    },
                  ]"
                  :key="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
           <el-row>
          <el-col :span="24">
            <el-form-item label="单位标签">
              <el-select v-model="sendData.multipleResponse" collapse-tags multiple clearable placeholder="请选择单位标签">
                <el-option
                  :label="item.dicname"
                  :value="item.dicname"
                  v-for="item in listA"
                  :key="item.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
            </el-row>
      </el-form>
    </rz-dialog>
  </div>
</template>
<script>
import {
  groupArea,
  viseUnitListSuper,
  exportqueryPeopleInfoNew,
  // sysDicUnitLabel,
  saveSuperViseUnitLabel,
  findListByCategory
} from "@/api/modules/enterprise";
import { exportGroupMealPilot } from "@/api/modules/coldLink";
export default {
  name: "archives",
  components: {},
  created() {
    if (this.$route.query.code) {
      this.query.areaCode = this.$route.query.code;
    } else {
      this.query.areaCode = "320500000000";
    }
    this.query.startDateCompletion = this.$moment().format("YYYY-MM-DD");
    this.query.endDateCompletion = this.$moment().format("YYYY-MM-DD");
    this.getweiOrder();
    this.findUnitBodyIndustryLink();
    this.findAreaListNoParentByParentCode();
    // this.unitLabel();
    this.findListByCategoryHandle()
  },
  mounted() {},
  data() {
    return {
      labelData: [],
      form: {},
      viewData: {},
      dialogVisible: false,
      show: process.env.NODE_ENV === "production",
      tableData: [],
      bodyindustryStr: "",
      sendData: {
        // labelName: [],
        id: "",
        unitName: "",
        updateName: sessionStorage.getItem("logname"),
        updateDepartment: sessionStorage.getItem("unitName"),
        newLicenseNo: "",
        typeA: "",
        typeAStr: "",
        districtCode: "",
        streetCode: "",
        regionType: "1",
        remark: "",
        unitstatusStr: "",
        multipleResponse:'',
      },
      // keyUnIt: "",
      query: {
        areaCode: "320500000000",
        bodyindustry: [],
        endDateCompletion: "",
        endDateRegistration: "",
        endindexScore: "",
        identify: "",
        isbbf: "0",
        iscollectivedistribution: "0",
        ishealthfood: "0",
        isinternetsales: "0",
        islargerkitchen: "0",
        isspecialfood: "0",
        isspecialmedicine: "0",
        label: "0",
        licensestatus: "1",
        newlicenseno: "",
        pageIndex: 1,
        pageSize: 10,
        startDateCompletion: "",
        startDateRegistration: "",
        startindexScore: "0",
        unitname: "",
        indexScore: "",
        // admin: 0,
        bodyindustryremarks: [],
        chiefInspector: [],
        keyUnit: [],
        pilotUnit: "",
        sort: "0",
        brisk: "1",
        unitstatusStr: "0",
        isPeople: "",
        legalUnitStatus:''
      },
      time: "",
      time1: [this.$moment().format("YYYY-MM-DD"), this.$moment().format("YYYY-MM-DD")],
      total: 0,
      options: [],
      optionsArea: [],
      optionsAreas: [],
      isList: [
        // {
        //   key: false,
        //   value: "单位业态备注",
        // },
        {
          key: false,
          value: "单位类型",
        },
        {
          key: false,
          value: "地址",
        },
        {
          key: false,
          value: "注册日期",
        },
        {
          key: true,
          value: "经营者名称",
        },
        {
          key: false,
          value: "许可发证日期",
        },
        {
          key: false,
          value: "许可有效期至",
        },
        {
          key: false,
          value: "许可状态",
        },
        {
          key: false,
          value: "执照核准日期",
        },
        {
          key: false,
          value: "特殊食品",
        },
        {
          key: false,
          value: "网络经营",
        },
        {
          key: false,
          value: "中央厨房",
        },
        {
          key: false,
          value: "集体用餐配送",
        },
        {
          key: false,
          value: "保健食品",
        },
        {
          key: false,
          value: "婴幼儿配方食品",
        },
        {
          key: false,
          value: "特殊医学用途配方食品",
        },
        {
          key: false,
          value: "从业人员数",
        },
        {
          key: false,
          value: "食品安全管理员数",
        },
        {
          key: false,
          value: "红码数",
        },
        {
          key: false,
          value: "黄码数",
        },
        {
          key: false,
          value: "绿码数",
        },
        {
          key: false,
          value: "未完善",
        },

        {
          key: false,
          value: "培训登记",
        },

        // {
        //   key: true,
        //   value: "食安承诺书",
        // },
        {
          key: true,
          value: "食安制度",
        },
        // {
        //   key: false,
        //   value: "进货检查有无上传",
        // },
        // {
        //   key: false,
        //   value: "人员任命有无上传",
        // },
        {
          key: true,
          value: "索证索票",
        },
        // {
        //   key: true,
        //   value: "常规性自查",
        // },
        {
          key: false,
          value: "全项目自查",
        },

        {
          key: false,
          value: "自查报告",
        },

        // {
        //   key: false,
        //   value: "索证索票",
        // },

        // {
        //   key: false,
        //   value: "快检管理",
        // },

        {
          key: true,
          value: "留样管理",
        },

        {
          key: true,
          value: "废弃物处理",
        },

        {
          key: true,
          value: "餐具消毒",
        },

        {
          key: true,
          value: "岗前检查",
        },

        {
          key: false,
          value: "菜谱管理",
        },

        {
          key: false,
          value: "食谱管理",
        },

        {
          key: false,
          value: "陪餐管理",
        },

        // {
        //   key: false,
        //   value: "检验管理",
        // },

        // "从业人员数"
        // "食品安全管理员数"
        // "二维码红码"
        // "二维码黄码"
        // "二维码绿码"
        // "二维码未完善"
        // "培训登记数(完成数据)"
        // "承诺书有无签约"
        // "承诺书有无上传"
        // "进货检查有无上传"
        // "人员任命有无上传"
        // "常规性自查任务数量"
        // "常规性自查完成数量"
        // "全项目自查任务数量"
        // "全项目自查完成数量"
        // "自查报告任务数量"
        // "自查报告完成数量"
        // "索证索票任务数量"
        // "索证索票完成数量"
        // "快检管理任务数量"
        // "快检管理完成数量"
        // "留样管理任务数量"
        // "留样管理完成数量"
        // "废弃物处理任务数量"
        // "废弃物处理完成数量"
        // "餐具消毒任务数量"
        // "餐具消毒完成数量"
        // "岗前检查任务数量"
        // "岗前检查完成数量"
        // "菜谱管理任务数量"
        // "菜谱管理完成数量"
        // "食谱管理任务数量"
        // "食谱管理完成数量"
        // "陪餐管理任务数量"
        // "陪餐管理完成数量"
        // "检验管理任务数量"
        // "检验管理完成数量"
      ],
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
      },
      bodyindustryList: [
        {
          value: "食品生产经营者",
          label: "食品生产经营者",
        },
        {
          value: "食品流通经营者",
          label: "食品流通经营者",
        },
        {
          value: "餐饮服务经营者",
          label: "餐饮服务经营者",
          children: [
            {
              value: "集体用餐配送或中央厨房",
              label: "集体用餐配送或中央厨房",
            },
            {
              value: "特大型餐饮",
              label: "特大型餐饮",
            },
            {
              value: "大型餐饮",
              label: "大型餐饮",
            },
            {
              value: "中型餐饮",
              label: "中型餐饮",
            },
            {
              value: "小型餐饮",
              label: "小型餐饮",
            },
            {
              value: "小餐饮备案",
              label: "小餐饮备案",
            },
            {
              value: "微型餐饮",
              label: "微型餐饮",
            },
            {
              value: "其他餐饮",
              label: "其他餐饮",
            },
          ],
        },
        {
          value: "单位食堂",
          label: "单位食堂",
          children: [
            {
              value: "幼托机构食堂",
              label: "幼托机构食堂",
            },
            {
              value: "学校食堂",
              label: "学校食堂",
            },
            {
              value: "养老机构食堂",
              label: "养老机构食堂",
            },
            {
              value: "工地食堂",
              label: "工地食堂",
            },
            {
              value: "机关企事业单位食堂",
              label: "机关企事业单位食堂",
            },
            {
              value: "其他食堂",
              label: "其他食堂",
            },
          ],
        },
        {
          value: "食品销售经营者",
          label: "食品销售经营者",
          children: [
            {
              value: "食品批发销售商",
              label: "食品批发销售商",
            },
            {
              value: "食品批发配送商",
              label: "食品批发配送商",
            },
            {
              value: "商场超市",
              label: "商场超市",
            },
            {
              value: "食杂店",
              label: "食杂店",
            },
            {
              value: "预包装食品销售",
              label: "预包装食品销售",
            },
          ],
        },
      ],
    };
  },
  // 方法
  methods: {
       findListByCategoryHandle(){
          findListByCategory({
        params: {
          category:'multiple',
        },
      }).then((res) => {
        // this.optionsArea = [res.data];
        // console.log(res);
        this.listA=res.data
      });
       },
    findFoodSafetyClassList(e) {
      this.query.pageIndex = e.page;
      this.getweiOrder();
    },
    findAreaListNoParentByParentCode() {
      groupArea({
        params: {
          areaCode: this.query.areaCode,
        },
      }).then((res) => {
        this.optionsArea = [res.data];
      });
      groupArea({
        params: {
          areaCode: "320500000000",
        },
      }).then((res) => {
        this.optionsAreas = [res.data];
      });
    },
    findUnitBodyIndustryLink() {
      this.$http.findUnitBodyIndustryLink({}).then((res) => {
        res.data.forEach((x, index) => {
          x.label = x.bodyIndustry;
          x.value = this.$_.uniqueId();
          if (x.list.length) {
            x.children = x.list.map((x, index) => ({
              label: x,
              value: this.$_.uniqueId(),
            }));
          } else {
            x.children = [{ label: x.bodyIndustry, value: this.$_.uniqueId() }];
          }
        });
        this.options = res.data;
      });
    },
    getweiOrder(e) {
      if (e) {
        this.query.pageIndex = 1;
      }
      viseUnitListSuper(this.query).then((res) => {
        this.tableData = res.data.list;
        this.total = res.totalCount;
      });
    },
    // 分页
    handleCurrentChange(e) {
      this.Page.pagenum = e;
      this.getweiOrder();
    },
    // 分页
    handleSizeChange(e) {
      this.Page.pagesize = e;
      this.getweiOrder();
    },
    // Cascader(e) {
    //   if (e) {
    //     this.query.bodyindustryStr = e[e.length - 1];
    //     this.options.map((x) => {
    //       x.children.map((x) => {
    //         if (x.value == e[e.length - 1]) {
    //           this.query.bodyindustry = x.label;
    //         }
    //       });
    //     });
    //   } else {
    //     this.query.bodyindustryStr = "";
    //     this.query.bodyindustry = "";
    //   }
    // },
    onCascaderChange(e) {
      // ,['食品生产经营者',"餐饮服务经营者","单位食堂","食品销售经营者"])
      if (!e.length) {
        this.query.bodyindustry = [];
        this.query.bodyindustryremarks = [];
      } else {
        this.query.bodyindustryremarks = this.$_.difference(this.$_.flattenDeep(e), [
          "食品生产经营者",
          "餐饮服务经营者",
          "食品流通经营者",
          "单位食堂",
          "食品销售经营者",
        ]);
        this.query.bodyindustry = this.$_.intersection(this.$_.flattenDeep(e), [
          "食品生产经营者",
          "餐饮服务经营者",
          "单位食堂",
          "食品流通经营者",
          "食品销售经营者",
        ]);
        // ["集体用餐配送或中央厨房"
        // ,"特大型餐饮"
        // ,"大型餐饮"
        // ,"中型餐饮"
        // ,"小型餐饮"
        // ,"微型餐饮"
        // ,"其他餐饮"]
        // if(this.$_.indexOf(this.query.bodyindustry,'餐饮服务经营者')!=-1){

        // }
        if (
          this.$_.intersection(this.query.bodyindustryremarks, [
            "集体用餐配送或中央厨房",
            "特大型餐饮",
            "大型餐饮",
            "中型餐饮",
            "小型餐饮",
            "微型餐饮",
            "其他餐饮",
          ]).length
        ) {
          this.query.bodyindustry = this.$_.pull(
            this.query.bodyindustry,
            "餐饮服务经营者"
          );
        }
        if (
          this.$_.intersection(this.query.bodyindustryremarks, [
            "幼托机构食堂",
            "学校食堂",
            "养老机构食堂",
            "工地食堂",
            "机关企事业单位食堂",
            "其他食堂",
          ]).length
        ) {
          this.query.bodyindustry = this.$_.pull(this.query.bodyindustry, "单位食堂");
        }

        if (
          this.$_.intersection(this.query.bodyindustryremarks, [
            "食品批发销售商",
            "商场超市",
            "食杂店",
          ]).length
        ) {
          this.query.bodyindustry = this.$_.pull(
            this.query.bodyindustry,
            "食品销售经营者"
          );
        }
      }

      // console.log(e);
      // if (e.length == 2) {
      //   this.query.bodyindustry = e[0];
      //   this.query.bodyindustryremarks = e[1];
      // } else if (e.length == 1) {
      //   this.query.bodyindustry = e[0];
      //   this.query.bodyindustryremarks = "";
      // } else {
      //   this.query.bodyindustry = "";
      //   this.query.bodyindustryremarks = "";
      // }
    },
    CascaderArea(e) {
      this.query.areaCode = e[e.length - 1];
    },
    changeScore(e) {
      if (e) {
        this.query.startindexScore = e.split("-")[0];
        this.query.endindexScore = e.split("-")[1];
      } else {
        this.query.startindexScore = "";
        this.query.endindexScore = "";
      }
    },
    registrationTime(e) {
      if (e) {
        this.query.startDateRegistration = e[0];
        this.query.endDateRegistration = e[1];
      } else {
        this.query.startDateRegistration = "";
        this.query.endDateRegistration = "";
      }
    },
    CompletionTime(e) {
      if (e) {
        this.query.startDateCompletion = e[0];
        this.query.endDateCompletion = e[1];
      } else {
        this.query.startDateCompletion = "";
        this.query.endDateCompletion = "";
      }
    },
    // enterprise(e) {
    //   sessionStorage.removeItem("menuSelect");
    //   // sessionStorage.setItem("router", "/foodSafety/archives/archives");
    //   sessionStorage.setItem("id", e.id);
    //   sessionStorage.setItem("newLicenseNo", e.newlicenseno);
    //   this.$router.push({ path: "/enterprise/home" });
    // },
    score(e) {
      // sessionStorage.setItem("id", e.id);
      sessionStorage.setItem("newLicenseNo", e.newlicenseno);
      sessionStorage.setItem("interpretation", e.id);
      this.$router.push({
        path: "/interpretation/home?url=/foodSafety/archives/archives",
        // query: { id: e.id },
      });
    },
    getExport(e) {
      exportqueryPeopleInfoNew({
        ...this.query,
        bodyindustryremarks: this.query.bodyindustryremarks.join(","),
        bodyindustry: this.query.bodyindustry.join(","),
        chiefInspector: this.query.chiefInspector.join(","),
        keyUnit: this.query.keyUnit.join(","),
      }).then((res) => {
        var blob = new Blob([res], {
          type: "application/vnd.ms-excel;charset=utf-8",
        });
        var downloadElement = document.createElement("a");
        var href = window.URL.createObjectURL(blob); //创建下载的链接
        downloadElement.href = href;
        downloadElement.download = "企业档案表" + new Date().getTime() + ".xlsx"; //下载后文件名
        document.body.appendChild(downloadElement);
        downloadElement.click(); //点击下载
        document.body.removeChild(downloadElement); //下载完成移除元素
        window.URL.revokeObjectURL(href); //释放掉blob对象
      });
    },
    getPilotExport() {
      this.query.pilotUnit = "1";
      exportGroupMealPilot({
        ...this.query,
        bodyindustryremarks: this.query.bodyindustryremarks.join(","),
        bodyindustry: this.query.bodyindustry.join(","),
        chiefInspector: this.query.chiefInspector.join(","),
        keyUnit: this.query.keyUnit.join(","),
      }).then((res) => {
        var blob = new Blob([res], {
          type: "application/vnd.ms-excel;charset=utf-8",
        });
        var downloadElement = document.createElement("a");
        var href = window.URL.createObjectURL(blob); //创建下载的链接
        console.log(href);
        downloadElement.href = href;
        downloadElement.download = "企业档案表" + new Date().getTime() + ".xlsx"; //下载后文件名
        document.body.appendChild(downloadElement);
        downloadElement.click(); //点击下载
        document.body.removeChild(downloadElement); //下载完成移除元素
        window.URL.revokeObjectURL(href); //释放掉blob对象
      });
    },
    sortChange(e) {
      if (e.order == "ascending") {
        this.query.sort = "2";
      } else if (e.order == "descending") {
        this.query.sort = "1";
      } else {
        this.query.sort = "0";
      }
      this.getweiOrder(1);
    },
    edit(e) {
      this.viewData = e;
      this.sendData.unitName = e.unitname;
      this.sendData.id = e.id;
      this.sendData.newLicenseNo = e.newlicenseno;
      this.sendData.streetCode = e.streetCode;
      this.sendData.districtCode = e.districtCode;
      this.sendData.unitstatusStr = e.unitstatusStr;
this.sendData.multipleResponse = e.multipleResponse.map(x=>x.labelName);
      this.sendData.remark = e.remark == "未设定" ? "" : e.remark;

      // this.sendData.labelName = [];

      // this.data.data.typeAStr=

      if (e.typeA) {
        let data = [
          {
            label: "特大型餐饮单位",
            value: 1,
          },
          {
            label: "中央厨房",
            value: 2,
          },
          {
            label: "养老机构食堂",
            value: 3,
          },
          {
            label: "集体用餐配送单位",
            value: 4,
          },
          {
            label: "学校食堂",
            value: 5,
          },
          {
            label: "特殊学校食堂",
            value: 6,
          },
          {
            label: "食品安全工作站",
            value: 7,
          },
            {
            label: "连锁企业门店",
            value: 8,
          },
        ].filter((x) => x.label == e.typeA);
        if (data.length) {
          this.sendData.typeAStr = data[0].value;
          this.sendData.typeA = data[0].label;
        }
      } else {
        this.sendData.typeAStr = "";
        this.sendData.typeA = "";
      }

      // if (e.label) {
      //   this.sendData.labelName = e.label.split(",");
      // }

      // if (e.keyUnIt) {
      //   this.sendData.labelName.push(e.keyUnIt);
      // }
      // this.keyUnIt = e.keyUnIt;
      this.dialogVisible = true;
    },
    // unitLabel() {
    //   sysDicUnitLabel({
    //     params: {
    //       category: "unit_lable",
    //     },
    //   }).then((res) => {
    //     this.labelData = res.data;
    //   });
    // },
    onconfirm() {
      let data = this.$_.cloneDeep(this.sendData);

      //   if ((this.keyUnIt && data.labelName.includes("重点单位"))||(!this.keyUnIt && !data.labelName.includes("重点单位"))) {
      //     // return
      //   }else{
      // if (data.labelName.includes("重点单位")) {
      if (data.typeAStr) {
        data.typeA = [
          {
            label: "特大型餐饮单位",
            value: "1",
          },
          {
            label: "中央厨房",
            value: "2",
          },
          {
            label: "养老机构食堂",
            value: "3",
          },
          {
            label: "集体用餐配送单位",
            value: "4",
          },
          {
            label: "学校食堂",
            value: "5",
          },
          {
            label: "特殊学校食堂",
            value: "6",
          },
          {
            label: "食品安全工作站",
            value: "7",
          },
            {
                      label: '连锁企业门店',
                      value: 8,
                    },
        ].filter((x) => x.value == data.typeAStr)[0].label;
      }
      // data.typeAStr = data.typeAStr;

      // } else {
      //   data.typeA = "";
      //   data.typeAStr = 0;
      // }

      // data.labelName = data.labelName.join(",");

      // districtCode: "320506"
      // id: "202110290002"
      // labelName: ""
      // newLicenseNo: "JY23205070203016"
      // regionType: "1"
      // streetCode: "320506001"
      // type: ""
      // typeA: ""
      // typeAStr: 0
      // unitName: "苏州市测试餐饮单位"
      // updateDepartment: "苏州市市场监督管理局"
      // updateName: "市局管理员"
      if(data.remark=='无需主体责任'){
                    data.remark=""
      }
      let send = {};
      if (data.typeAStr == "" && data.remark == "") {
        send.typeAStr = 0;
        send.labelName = "";
      } else if (data.typeAStr == "" && data.remark) {
        send.labelName = "总监企业";
        send.typeAStr = 0;
      } else if (data.typeAStr && data.remark == "") {
        send.labelName = "";
      } else if (data.typeAStr && data.remark) {
        send.labelName = "总监企业";
      }
      if (
        data.remark == "其他企业(无需设置总监)" ||
        data.remark == "其他企业(无需设置总监)(仅限市平台单位)"
      ) {
        send.labelName = "特殊总监企业";
      }

      saveSuperViseUnitLabel([
        {
          ...data,
          ...send,
        },
      ]).then((res) => {
        this.dialogVisible = false;
        this.getweiOrder(1);
      });
      // saveBackGround
    },
  },
  // 监听属性
  watch: {
    "query.chiefInspector": {
      handler: function (newValue) {
        if (newValue.length > 1 && newValue.includes("未设置")) {
          this.query.chiefInspector = this.query.chiefInspector.filter(
            (x) => x != "未设置"
          );
        }
      },
    },
    "query.keyUnit": {
      handler: function (newValue) {
        if (newValue.length > 1 && newValue.includes("未设置")) {
          this.query.keyUnit = this.query.keyUnit.filter((x) => x != "未设置");
        }
      },
    },
  "sendData.unitstatusStr": {
      handler: function (newValue) {
              if(newValue!='0'){
                     this.sendData.remark='无需主体责任'
                     if(this.sendData.newLicenseNo){
                      this.sendData.typeAStr=''
                     }
                     
              }
      },
    },

    
  },
  // 组件
  components: {},
  // 计算属性
  computed: {},
};
</script>

<style lang="less" scoped>
.right {
  text-align: right;
}
.el-button {
  margin-left: 20px;
}
.el-dropdown-menu {
  height: 600px;
  overflow: auto;
}
</style>
